package com.zbf.task.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author: LCG
 * 作者: LCG
 * 日期: 2021/3/12  14:35
 * 描述:
 */
@Mapper
@Repository
public interface TestOrderMapper {

    @Insert("insert into base_order(id,goods_id,quantity,createTime,version)values(#{id},#{goodsId},#{quantity},NOW(),#{version})")
    public int insertOrder(Map<String, Object> order);

    @Insert("insert into base_message_recod(id,orderId,state,createTime,orderMs)values(#{id},#{orderId},#{state},NOW(),#{orderMs})")
    public int insertOrderMesg(Map<String, Object> orderMsg);

    @Update("update base_message_recod set state=#{state} where id=#{id}")
    public int updateOrder(Map<String, Object> orderMsg);

    @Select("select * from base_message_recod where state=3 limit 10")
    public List<Map<String,Object>> getUnSendMsg();


    @Select("select state from base_message_recod where orderId=#{orderId}")
    public Map<String,Object> getUnSendMsg02(String orderId);

    /**
     * 作者: LCG
     * 日期: 2021/3/12  16:38
     * 描述: 插入表二base_message_recod2
     * @Param [orderMsg]
     * @Return int
     */
    @Insert("insert into base_message_recod2(id,orderId,state,createTime,orderMs)values(#{id},#{orderId},#{state},NOW(),#{orderMs})")
    public int insertOrderMesg2(Map<String, Object> orderMsg);


    @Select("select * from base_message_recod where id=#{id}")
    public Map<String,Object> getOrderInfo(String id);
}
